<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
	<title>Details for enrichment of {{ rowmeta.transcript_id }} on sample set {{ sample_set.name }}</title>

	<link rel="stylesheet" href="web/gridtable.css" type="text/css" media="print, projection, screen" />
</head>

<body>

<h1>SSEA Detailed Report</h1>
<h2>Enrichment of {{ rowmeta.transcript_id }} on sample set {{ sample_set.name }}</h2>

<br/>

<table class="gridtable">
<thead>
<tr><th>Parameter</th><th>Value</th></tr>
</thead>
<tbody>
<tr><td>Name</td><td>{{ rowmeta.transcript_id }}</td></tr>
<tr><td>Sample set name</td><td>{{ sample_set.name }}</td></tr>
<tr><td>Sample set description</td><td>{{ sample_set.desc }}</td></tr>
<tr><td>Sample set size</td><td>{{ sample_set.sample_ids|length }}</td></tr>
<tr><td>Enrichment Score (ES)</td><td>{{ result.es }}</td></tr>
<tr><td>Normalized Enrichment Score (NES)</td><td>{{ result.nes }}</td></tr>
<tr><td>Nominal p-value</td><td>{{ result.nominal_p_value }}</td></tr>
<tr><td>Sample Set Rank</td><td>{{ result.ss_rank }}</td></tr>
<tr><td>Sample Set Percentile</td><td>{{ 100.0 * result.ss_frac }}</td></tr>
<tr><td>Sample Set FDR q-value</td><td>{{ result.ss_fdr_q_value }}</td></tr>
<tr><td>Rank at maximum running ES</td><td>{{ result.es_rank }}</td></tr>
<tr><td>Leading edge hits</td><td>{{ result.core_hits }}</td></tr>
<tr><td>Leading edge misses</td><td>{{ result.core_misses }}</td></tr>
<tr><td>Non leading edge hits</td><td>{{ result.null_hits }}</td></tr>
<tr><td>Non leading edge misses</td><td>{{ result.null_misses }}</td></tr>
<tr><td>Fisher's p-value</td><td>{{ result.fisher_p_value }}</td></tr>
<tr><td>OR</td><td>{{ result.odds_ratio }}</td></tr>
</tbody>
</table>

<br/>

{% if 'eplot_png' in files %}
<img name="enplot_{{ rowmeta.transcript_id }}_vs_{{ sample_set.name }}" src="{{ files.eplot_png }}"/>
<br/>
Fig 1: Enrichment plot for {{ sample_set.name }}
<br/>
Profile of the running ES score & positions of sample set members in the ordered list
<br/>
{% else %}
No enrichment plot available
{% endif %}

{% if 'eplot_pdf' in files %}
<a href="{{ files.eplot_pdf }}">Download Enrichment Plot PDF</a>
{% endif %}

<br/>

{% if 'exprplot_png' in files %}
<img name="exprplot_{{ rowmeta.transcript_id }}_vs_{{ sample_set.name }}" src="{{ files.exprplot_png }}"/>
<br/>
Fig 2: Expression plot for {{ sample_set.name }}
<br/>
{% else %}
No expression plot available
{% endif %}
{% if 'exprplot_pdf' in files %}
<a href="{{ files.exprplot_pdf }}">Download Expression Plot PDF</a>
{% endif %}

<br/>

<table class="gridtable">
<thead>
<tr><th>Metadata Parameter</th><th>Value</th></tr>
</thead>
<tbody>
{% for key,value in rowmeta|dictsort %}
    <tr><td>Metadata: {{ key }}</td><td>{{ value }}</td></tr>
{% endfor %}
</tbody>
</table>

<br/>

Detailed results
<br/>
<a href="{{ files.tsv }}">Download as text</a>
<table class="gridtable">
<thead>
<tr>{% for colname in details[0] %}<th>{{ colname }}</th>{% endfor %}</tr>
</thead>
<tbody>
{% for row in details[1:] %}
<tr>
  {% for val in row %}
  <td>{{ val }}</td>
  {% endfor %}
</tr>
{% endfor %}
</tbody>
</table>

</body>
</html>